package star.cloud.asme.system.department;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import star.cloud.asme.base.dto.Result;
import star.cloud.asme.base.mybatis.IBaseController;

import java.util.List;

@RestController
@RequestMapping("/system/department")
@RequiredArgsConstructor
public class DepartmentController implements IBaseController<Department> {

    private final DepartmentService departmentService;

    @Override
    public Result<Department> getOneByCondition(String columnName, Object columnValue) {
        return departmentService.getOneByCondition(columnName, columnValue);
    }

    @Override
    public Result<Department> insertOne(Department entity) {
        return departmentService.insertOne(entity);
    }

    @Override
    public Result<?> physicalDeleteById(Long id) {
        return departmentService.physicalDeleteById(id);
    }

    @Override
    public Result<?> logicalDeleteById(Long id) {
        return departmentService.logicalDeleteById(id);
    }

    @Override
    public Result<Department> updateOne(Department entity) {
        return departmentService.updateOne(entity);
    }

    @Override
    public Result<List<Department>> getTree() {
        return departmentService.getTree();
    }

    @GetMapping("/getCascade")
    public Result<List<Department>> getCascade() {
        return departmentService.getCascade();
    }

}